export type Enum<E> = Record<keyof E, number | string> & { [key: number]: string };

export function enum2options<E extends Enum<E>>(enums: Enum<E>) {
  return Object.values(enums)
    .map((value) => ({ value, label: enums[+value] }))
    .filter((o) => !!o.label);
}
